//package com.egao.common.module.system.transfer;
//
//import cn.hutool.core.date.DateUtil;
//import cn.hutool.core.date.TimeInterval;
//import cn.hutool.core.util.StrUtil;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.egao.common.core.Constants;
//import com.egao.common.core.web.JsonResult;
//import com.egao.common.module.company.entity.Company;
//import com.egao.common.module.company.service.CompanyService;
//import com.egao.common.module.student.constants.StudentConstants;
//import com.egao.common.module.student.constants.StudentSignConstants;
//import com.egao.common.module.student.entity.Student;
//import com.egao.common.module.student.entity.StudentSign;
//import com.egao.common.module.student.service.DispatchCompanyService;
//import com.egao.common.module.student.service.StudentService;
//import com.egao.common.module.student.service.StudentSignService;
//import com.egao.common.module.student.service.impl.StudentSignServiceImpl;
//import com.egao.common.module.system.constants.DictConstants;
//import com.egao.common.module.system.constants.UserConstants;
//import com.egao.common.module.system.entity.QsSchool;
//import com.egao.common.module.system.entity.User;
//import com.egao.common.module.system.service.DictService;
//import com.egao.common.module.system.service.QsSchoolService;
//import com.egao.common.module.system.service.UserService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.sql.*;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//
///**
// * 学生签约数据迁移
// *
// * @author lym
// */
//@Api(tags = "学生签约数据迁移")
//@RestController
//@Slf4j
//public class StudentSignDataController {
//
//    @Autowired
//    private StudentSignService studentSignService;
//    @Autowired
//    private StudentService studentService;
//    @Autowired
//    private CompanyService companyService;
//    @Autowired
//    private DictService dictService;
//    @Autowired
//    private DispatchCompanyService dispatchCompanyService;
//    @Autowired
//    private QsSchoolService qsSchoolService;
//    @Autowired
//    private UserService userService;
//
//    String PATH = "/zuel/old/sign";
//
//    @Value("${old.datasource.ms-url}")
//    private String msUrl;
//    @Value("${old.datasource.ms-name}")
//    private String msName;
//    @Value("${old.datasource.ms-pwd}")
//    private String msPwd;
//
//    /**
//     * 同步前：
//     * 1.检查单位邮政编码、派遣单位邮政编码，保证6位数邮编
//     * <p>
//     * <p>
//     * 同步后：
//     * 1.协议就业 单位邀约 同步完成后检查单位性质、行业。没有则去单位表里同步
//     *
//     * @return
//     */
//    @ApiOperation("数据迁移")
//    public JsonResult insert() {
//        TimeInterval timer = DateUtil.timer();
//        String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
//        String dbUrl = msUrl;
//        String name = msName;
//        String password = msPwd;
//
//        Connection conn = null;
//
//        try {
//            Class.forName(driverName);
//            conn = DriverManager.getConnection(dbUrl, name, password);
//            Statement st = conn.createStatement();
//
//            String sql = "SELECT * FROM Sign_Temp ORDER BY createTime ASC";
//            ResultSet rs = st.executeQuery(sql);
//
//            String xhErrors = "";
//            String companyErrors = "";
//            String collegeErrors = "";
//
//            List<Student> studentList = new ArrayList<>();
//            List<StudentSign> studentSignList = new ArrayList<>();
//            int i = 0;
//            while (rs.next()) {
//                System.out.println(i++);
//                StudentSign studentSign = new StudentSign();
//
//                Student student = null;
//                String xh = rs.getString("XH");
//                if (!StrUtil.isBlank(xh)) {
//                    student = studentService.getByXh(xh);
//                    if (student == null) {
//                        xhErrors += "'" + xh + "',";
//                        continue;
//                    }
//                }
//
//                User college = null;
//                String xygh = rs.getString("XYGH");
//                if (!StrUtil.isBlank(xygh)) {
//                    college = userService.getByUsername(xygh);
//                    if (college == null) {
//                        collegeErrors += "'" + xygh + "',";
//                    }
//                }
//
//                String signCategory = rs.getString("signCategory");
//                String Organization = rs.getString("dealCompanyOrganizationCode");
//                Company company = null;
//                if (!StrUtil.isBlank(Organization) && StudentSignConstants.SIGN_CATEGORY_XYJY.equals(signCategory)) {
//                    company = companyService.getCompanyByOrganizationCode(Organization);
//                    if (company == null) {
//                        companyErrors += "'" + Organization + "',";
//                    }
//                }
//
//                studentSign.setOldId(rs.getInt("ID"));
//                studentSign.setOldCategory(rs.getInt("Category"));
//                studentSign.setState(rs.getString("State"));
//                studentSign.setUserId(student.getUserId());
//                studentSign.setStudentId(student.getId());
//                studentSign.setCompanyId(company != null ? company.getId() : null);
//                studentSign.setCreateTime(DateUtil.parse(rs.getString("createTime")));
//                studentSign.setDeleted(rs.getInt("deleted"));
//                studentSign.setCollegeUserId(college != null ? college.getUserId() : null);
//
//                studentSign.setSerialNumber(rs.getString("serialNumber"));
//                studentSign.setState(rs.getString("state"));
//                studentSign.setSignCategory(signCategory);
//                studentSign.setSignWay(rs.getString("signWay"));
//                studentSign.setSignState(rs.getString("signState"));
//                studentSign.setDispatchState(rs.getString("dispatchState"));
//                studentSign.setSignTime(DateUtil.parse(rs.getString("signTime")));
//                studentSign.setSignAgreedTime(DateUtil.parse(rs.getString("signAgreedTime")));
//                studentSign.setSignInvitedTime(DateUtil.parse(rs.getString("signInvitedTime")));
//                studentSign.setSignExpiredTime(DateUtil.parse(rs.getString("signExpiredTime")));
//                studentSign.setSignTerminationTime(DateUtil.parse(rs.getString("signTerminationTime")));
//                studentSign.setTerminationTitle(rs.getString("terminationTitle"));
//                studentSign.setTerminationContent(rs.getString("terminationContent"));
//                studentSign.setTerminationImg(rs.getString("terminationImg"));
//                studentSign.setTerminationTime(DateUtil.parse(rs.getString("terminationTime")));
//
//                studentSign.setDispatch(rs.getInt("dispatch"));
//                studentSign.setDispatchTime(DateUtil.parse(rs.getString("dispatchTime")));
//                studentSign.setDealCategory(rs.getString("dealCategory"));
//                studentSign.setDealRolePick(rs.getString("dealRolePick"));
//                studentSign.setDealCompanyOrganizationCode(rs.getString("dealCompanyOrganizationCode"));
//                studentSign.setDealSignCompanyName(rs.getString("dealSignCompanyName"));
//                studentSign.setDealCompanySuperiorDepartment(rs.getString("dealCompanySuperiorDepartment"));
//                studentSign.setDealCompanyAddressLevel(rs.getString("dealCompanyAddressLevel"));
//                studentSign.setDealCompanyNature(rs.getString("dealCompanyNature"));
//                studentSign.setDealCompanyIndustry(rs.getString("dealCompanyIndustry"));
//                studentSign.setDealHbIndustry(rs.getString("dealHbIndustry"));
//                studentSign.setDealCompanyContactName(rs.getString("dealCompanyContactName"));
//                studentSign.setDealCompanyContactMobile(rs.getString("dealCompanyContactMobile"));
//                studentSign.setDealCompanyContactZip(rs.getString("dealCompanyContactZip"));
//                studentSign.setDealCompanyContactEmail(rs.getString("dealCompanyContactEmail"));
//                studentSign.setDealCompanyContactAddress(rs.getString("dealCompanyContactAddress"));
//                studentSign.setDealCompanyName(rs.getString("dealCompanyName"));
//                studentSign.setDealCompanyAddress(rs.getString("dealCompanyAddress"));
//                studentSign.setDealExpireTime(rs.getString("dealExpireTime"));
//                studentSign.setDealWorkAddress(rs.getString("dealWorkAddress"));
//                studentSign.setDealWorkPosition(rs.getString("dealWorkPosition"));
//                studentSign.setDealWorkJobCategory(rs.getString("dealWorkJobCategory"));
//                studentSign.setDealReportTime(rs.getString("dealReportTime"));
//                studentSign.setDealReportAddress(rs.getString("dealReportAddress"));
//                studentSign.setDealTryoutTime(rs.getString("dealTryoutTime"));
//                studentSign.setDealTryoutSalary(rs.getString("dealTryoutSalary"));
//                studentSign.setDealFormalSalary(rs.getString("dealFormalSalary"));
//                studentSign.setDealPenalty(rs.getString("dealPenalty"));
//                studentSign.setDealRemarks(rs.getString("dealRemarks"));
//
//                studentSign.setCenterImg(rs.getString("centerImg"));
//                studentSign.setDispatchHiredWay(dictService.cacheValue(DictConstants.TYPE_SIGN_LYFS, rs.getString("dispatchHiredWay")));
//                studentSign.setDispatchJobCategory(rs.getString("dispatchJobCategory"));
//                studentSign.setDispatchGradWhere(rs.getString("dispatchGradWhere"));
//                studentSign.setDispatchReportIssuedCategory(rs.getString("dispatchReportIssuedCategory"));
//                studentSign.setDispatchReportCompany(rs.getString("dispatchReportCompany"));
//                studentSign.setDispatchReportCompanyProvince(rs.getString("dispatchReportCompanyProvince"));
//                studentSign.setDispatchReportCompanyAddress(rs.getString("dispatchReportCompanyAddress"));
//                studentSign.setDispatchArchivesCompany(rs.getString("dispatchArchivesCompany"));
//                studentSign.setDispatchArchivesAddress(rs.getString("dispatchArchivesAddress"));
//                studentSign.setDispatchArchivesZip(rs.getString("dispatchArchivesZip"));
//                studentSign.setDispatchArchivesMobile(rs.getString("dispatchArchivesMobile"));
//                studentSign.setDispatchHkAddressWho(rs.getString("dispatchHkAddressWho"));
//                studentSign.setDispatchHkAddress(rs.getString("dispatchHkAddress"));
//                studentSign.setDispatchCompanyMembership(rs.getString("dispatchCompanyMembership"));
//                studentSign.setDispatchCompanyName(rs.getString("dispatchCompanyName"));
//                studentSign.setDispatchCompanyCode(rs.getString("dispatchCompanyCode"));
//                studentSign.setDispatchManagedWhere(rs.getString("dispatchManagedWhere"));
//                studentSign.setDispatchJobCondition(rs.getString("dispatchJobCondition"));
//                studentSign.setExt1(rs.getString("ext1"));
//                studentSign.setExt2(rs.getString("ext2"));
//                studentSign.setExt5(rs.getString("ext5"));
//                studentSign.setRecordImg(rs.getString("recordImg"));
//                studentSign.setRecordContent(rs.getString("recordContent"));
//
//                studentSign.setSurveyStartingSalary(rs.getString("surveyStartingSalary"));
//                studentSign.setSurveyPosition(rs.getString("surveyPosition"));
//                studentSign.setSurveyWay(rs.getString("surveyWay"));
//                studentSign.setSurveyCompany(rs.getString("surveyCompany"));
//                studentSign.setSurveyJob(rs.getString("surveyJob"));
//                studentSign.setSurveyMatching(rs.getString("surveyMatching"));
//                studentSign.setSurveyOffer(rs.getString("surveyOffer"));
//                studentSign.setSurveySchool(rs.getString("surveySchool"));
//                studentSign.setSurveySalary(rs.getString("surveySalary"));
//
//                if (StudentSignConstants.SIGN_CATEGORY_LHJY.equals(signCategory)) {
//                    studentSign.setAgileAddress(rs.getString("AgileAddress"));
//                    studentSign.setAgilePositionTime(rs.getString("AgilePositionTime"));
//                    studentSign.setAgileTermTime(rs.getString("AgileTermTime"));
//                }
//
//                if (StudentSignConstants.SIGN_CATEGORY_ZYZY.equals(signCategory)) {
//                    studentSign.setFreeWorkAddress(rs.getString("FreeWorkAddress"));
//                    studentSign.setFreeWorkContent(rs.getString("FreeWorkContent"));
//                }
//
//                if (StudentSignConstants.SIGN_CATEGORY_ZZCY.equals(signCategory)) {
//                    String ventureExplain = rs.getString("VentureExplain");
//                    ventureExplain = "实体创业".equals(ventureExplain) ? "1" : "2";
//                    studentSign.setVentureExplain(ventureExplain);
//                    studentSign.setVentureCompanyName(rs.getString("VentureCompanyName"));
//                    studentSign.setVentureComapnyPlace(rs.getString("VentureComapnyPlace"));
//                    studentSign.setVenturePlaceImg(rs.getString("VenturePlaceImg"));
//                    studentSign.setVentureWebsite(rs.getString("VentureWebsite"));
//                    studentSign.setVentureBusinessImg(rs.getString("VentureBusinessImg"));
//                    String ventureBusinessRegistered = rs.getString("VentureBusinessRegistered");
//                    ventureBusinessRegistered = "有".equals(ventureBusinessRegistered) ? "0" : "1";
//                    studentSign.setVentureBusinessRegistered(ventureBusinessRegistered);
//                    studentSign.setVentureComapnyScope(rs.getString("VentureComapnyScope"));
//                    studentSign.setVentureRegisteredTime(rs.getString("VentureRegisteredTime"));
//                }
//
//                if (StudentSignConstants.SIGN_CATEGORY_CGCJ.equals(signCategory)) {
//                    studentSign.setAbroadContinent(7);
//                    studentSign.setAbroadCountry(8);
//                    String address = rs.getString("AbroadSchool");
//                    if (!StrUtil.isBlank(address)) {
//                        QsSchool qsSchool = qsSchoolService.getOne(new QueryWrapper<QsSchool>()
//                                .eq("parent_id", 8)
//                                .eq("name", address.trim())
//                                .last("limit 1")
//                        );
//                        if (qsSchool != null) {
//                            studentSign.setAbroadSchool(qsSchool.getId());
//                        } else {
//                            QsSchool newQsSchool = new QsSchool();
//                            newQsSchool.setParentId(8);
//                            newQsSchool.setName(address);
//                            qsSchoolService.save(newQsSchool);
//                            studentSign.setAbroadSchool(newQsSchool.getId());
//                        }
//                    } else {
//                        studentSign.setAbroadSchool(9);
//                    }
//                    studentSign.setAbroadOfferImg(rs.getString("AbroadOfferImg"));
//                }
//
//                if (StudentSignConstants.SIGN_CATEGORY_SX.equals(signCategory)) {
//                    studentSign.setStudySchoolName(rs.getString("StudySchoolName"));
//                    studentSign.setStudySchoolAddress(rs.getString("StudySchoolAddress"));
//                    studentSign.setStudySchoolProvince(rs.getString("StudySchoolProvince"));
//                    studentSign.setStudySchoolAddressLevel(rs.getString("StudySchoolAddressLevel"));
//
//                    String StudySchoolAdmissionWay = rs.getString("StudySchoolAdmissionWay");
//                    StudySchoolAdmissionWay = "保送".equals(StudySchoolAdmissionWay) ? "1":"2";
//                    studentSign.setStudySchoolAdmissionWay(StudySchoolAdmissionWay);
//
//                    String studySchoolCrossMajor = rs.getString("StudySchoolCrossMajor");
//                    if ("外校跨专业".equals(studySchoolCrossMajor)) {
//                        studySchoolCrossMajor = "1";
//                    }
//                    if ("外校本专业".equals(studySchoolCrossMajor)) {
//                        studySchoolCrossMajor = "2";
//                    }
//                    if ("本校跨专业".equals(studySchoolCrossMajor)) {
//                        studySchoolCrossMajor = "3";
//                    }
//                    if ("本校本专业".equals(studySchoolCrossMajor)) {
//                        studySchoolCrossMajor = "4";
//                    }
//                    studentSign.setStudySchoolCrossMajor(studySchoolCrossMajor);
//
//                    studentSign.setStudyExtraOne(rs.getString("StudyExtraOne"));
//                    studentSign.setStudyExtraTwo(rs.getString("StudyExtraTwo"));
//                    studentSign.setStudyImg(rs.getString("StudyImg"));
//                }
//
//
//                if (StudentSignConstants.STATE_VALID.equals(studentSign.getState())) {
//                    Student updateStudent = new Student();
//                    updateStudent.setId(student.getId());
//                    updateStudent.setSignCategory(signCategory);
//                    studentList.add(updateStudent);
//                }
//
//                String dealCompanyContactZip = studentSign.getDealCompanyContactZip();
//                if (StrUtil.isBlank(dealCompanyContactZip)) {
//                    studentSign.setDealCompanyContactZip("000000");
//                } else if (!StrUtil.isBlank(dealCompanyContactZip) && dealCompanyContactZip.trim().length() > 6) {
//                    studentSign.setDealCompanyContactZip("000001");
//                } else if (!StrUtil.isBlank(dealCompanyContactZip) && dealCompanyContactZip.trim().length() < 6) {
//                    studentSign.setDealCompanyContactZip("000002");
//                } else {
//                    studentSign.setDealCompanyContactZip(dealCompanyContactZip.trim());
//                }
//
//                String dispatchArchivesZip = studentSign.getDispatchArchivesZip();
//                if (StrUtil.isBlank(dispatchArchivesZip)) {
//                    studentSign.setDispatchArchivesZip("000000");
//                } else if (!StrUtil.isBlank(dispatchArchivesZip) && dispatchArchivesZip.trim().length() > 6) {
//                    studentSign.setDispatchArchivesZip("000001");
//                } else if (!StrUtil.isBlank(dispatchArchivesZip) && dispatchArchivesZip.trim().length() < 6) {
//                    studentSign.setDispatchArchivesZip("000002");
//                } else {
//                    studentSign.setDispatchArchivesZip(dispatchArchivesZip.trim());
//                }
//
//                studentSignList.add(studentSign);
//            }
//
//            studentService.updateBatchById(studentList);
//            studentSignService.saveBatch(studentSignList);
//
//            log.info("网签数据迁移完成：" + timer.intervalMinute());
//            return JsonResult.ok("网签数据迁移完成：" + timer.intervalMinute()+"。成功：" + xhErrors + "----" + companyErrors + "----" + collegeErrors);
//        } catch (ClassNotFoundException | SQLException e) {
//            return JsonResult.error("连接失败：" + e.getMessage());
//        }
//    }
//
//    /**
//     * 签约数据迁移
//     * 注意事项：
//     * 1.数据完成迁移后，检测学生签约state属性。每个学生只有一个state=0的数据，如果有多个需要处理成一个
//     * 2.迁移前检查ZipCode DaForwardingCode 是否为6位
//     *
//     * @return
//     */
//    @ApiOperation("签约数据迁移")
//    @GetMapping("/publicly/transfer/student/sign")
//    public JsonResult update() {
//
//        String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
//        String dbUrl = "jdbc:sqlserver://192.168.1.144:1433;DatabaseName=TestLawOnlineSignDB";
//        String name = "sa";
//        String password = "123456";
//
//        Connection conn = null;
//
//        List<Student> students = studentService.list();
//        List<Company> companys = companyService.list();
//
//        try {
//            Class.forName(driverName);
//            conn = DriverManager.getConnection(dbUrl, name, password);
//            Statement st = conn.createStatement();
//
//            String sql = "SELECT\n" +
//                    "sign.SignID,\n" +
//                    "sign.State,\n" +
//                    "s.StudentNo,\n" +
//                    "s.IsLock,\n" +
//                    "s.EmploymentWay,\n" +
//                    "c.Organization,\n" +
//                    "c.CompanyName,\n" +
//                    "c.SuperiorDepartment,\n" +
//                    "c.Contact,\n" +
//                    "c.Tel,\n" +
//                    "c.ZipCode,\n" +
//                    "c.Email,\n" +
//                    "c.Address,\n" +
//                    "b1.KeyValue LocationLevel,\n" +
//                    "b2.KeyValue Nature,\n" +
//                    "b3.KeyValue Industry,\n" +
//                    "b4.KeyValue KeyIndustry,\n" +
//                    "sign.CompanyName dealCompanyName,\n" +
//                    "sign.SignState,\n" +
//                    "sign.SurrenderState,\n" +
//                    "sign.SignGenerateType,\n" +
//                    "sign.TableID,\n" +
//                    "sign.CollegeCheckTime,\n" +
//                    "sign.CreateTime,\n" +
//                    "sign.SurrenderTime,\n" +
//                    "sign.SurrenderReason,\n" +
//                    "sign.SurrenderComment,\n" +
//                    "sign.SurrenderFileUrl,\n" +
//                    "sign.IsHiringMode,\n" +
//                    "c.Location,\n" +
//                    "sign.HirePeriod,\n" +
//                    "sign.WorkingPlace,\n" +
//                    "sign.JobPosition,\n" +
//                    "b11.KeyValue JobPositionCategory,\n" +
//                    "sign.RegistrationPeriod,\n" +
//                    "sign.RegistrationPlace,\n" +
//                    "sign.OnTrialTime,\n" +
//                    "sign.TheProbationPeriodSalary,\n" +
//                    "sign.PositiveAfterStartingSalary,\n" +
//                    "sign.LiquidatedDamages,\n" +
//                    "sign.ProtocolNote,\n" +
//                    "b5.BasicDataName HiringMode,\n" +
//                    "b6.KeyValue EmploymentType,\n" +
//                    "b7.KeyValue Graduate,\n" +
//                    "b8.KeyValue JobCategory,\n" +
//                    "sign.ReportCardToUnitName,\n" +
//                    "b12.KeyValue UnitOfTheProvince,\n" +
//                    "sign.UnitLocation,\n" +
//                    "sign.DaForwardingUnitName,\n" +
//                    "sign.DaForwardingAddress,\n" +
//                    "sign.DaForwardingCode,\n" +
//                    "sign.DaForwardingTel,\n" +
//                    "sign.AddressOfAddress,\n" +
//                    "sign.AccountMigrationAddress,\n" +
//                    "sign.UnitSubjection,\n" +
//                    "b9.KeyValue EmploymentState,\n" +
//                    "b10.KeyValue MonthlySalaryGrade,\n" +
//                    "b13.KeyValue GetUnitInfo,\n" +
//                    "b14.KeyValue UnitSatisfaction,\n" +
//                    "b15.KeyValue IsCorrelation,\n" +
//                    "b16.KeyValue IsMatching,\n" +
//                    "b17.KeyValue OfferNum,\n" +
//                    "b18.KeyValue SchoolWorkSatisfaction,\n" +
//                    "sign.PicUrl PicUrl,\n" +
//                    "sign.JyUrl JyUrl,\n" +
//                    "sign.CertifyUrl CertifyUrl\n" +
//                    "FROM Sign sign\n" +
//                    "LEFT JOIN Student s ON s.StudentID = sign.StudentID\n" +
//                    "LEFT JOIN Company c ON c.CompanyID = sign.CompanyID\n" +
//                    "LEFT JOIN BasicData b1 ON b1.BasicDataID = c.LocationLevel\n" +
//                    "LEFT JOIN BasicData b2 ON b2.BasicDataID = c.Nature\n" +
//                    "LEFT JOIN BasicData b3 ON b3.BasicDataID = c.Industry\n" +
//                    "LEFT JOIN BasicData b4 ON b4.BasicDataID = c.KeyIndustry\n" +
//                    "LEFT JOIN BasicData b5 ON b5.KeyValue = sign.HiringMode AND b5.BasicDataTypeID = 15\n" +
//                    "LEFT JOIN BasicData b6 ON b6.BasicDataID = s.EmploymentType\n" +
//                    "LEFT JOIN BasicData b7 ON b7.BasicDataID = sign.Graduate\n" +
//                    "LEFT JOIN BasicData b8 ON b8.BasicDataID = sign.JobCategory\n" +
//                    "LEFT JOIN BasicData b9 ON b9.BasicDataID = sign.EmploymentState\n" +
//                    "LEFT JOIN BasicData b10 ON b10.BasicDataID = sign.MonthlySalaryGrade\n" +
//                    "LEFT JOIN BasicData b11 ON b11.BasicDataID = sign.JobPositionCategory\n" +
//                    "LEFT JOIN BasicData b12 ON b12.BasicDataID = sign.UnitOfTheProvince\n" +
//                    "LEFT JOIN BasicData b13 ON b13.BasicDataID = sign.GetUnitInfo\n" +
//                    "LEFT JOIN BasicData b14 ON b14.BasicDataID = sign.UnitSatisfaction\n" +
//                    "LEFT JOIN BasicData b15 ON b15.BasicDataID = sign.IsCorrelation\n" +
//                    "LEFT JOIN BasicData b16 ON b16.BasicDataID = sign.IsMatching\n" +
//                    "LEFT JOIN BasicData b17 ON b17.BasicDataID = sign.OfferNum\n" +
//                    "LEFT JOIN BasicData b18 ON b18.BasicDataID = sign.SchoolWorkSatisfaction";
//            ResultSet rs = st.executeQuery(sql);
//
//            String xhErrors = "";
//            String companyErrors = "";
//
//            List<Student> studentList = new ArrayList<>();
//            List<StudentSign> studentSignList = new ArrayList<>();
//
//            while (rs.next()) {
//                StudentSign studentSign = new StudentSign();
//
//                String xh = rs.getString("StudentNo");
//                Student student = null;
//                for (Student s : students) {
//                    if (!StrUtil.isBlank(xh) && xh.equals(s.getXh())) {
//                        student = s;
//                        break;
//                    }
//                }
//                if (student == null) {
//                    xhErrors += "'" + xh + "',";
//                    continue;
//                }
//
//                String Organization = rs.getString("Organization");
//                Company company = null;
//                for (Company c : companys) {
//                    if (!StrUtil.isBlank(Organization) && Organization.trim().equals(c.getOrganizationCode())) {
//                        company = c;
//                        break;
//                    }
//                }
//                if (company == null) {
//                    companyErrors += "'" + Organization + "',";
//                    continue;
//                }
//
//                int deleted = rs.getInt("State");
//                if (1 == deleted) {
//                    studentSign.setDeleted(0);
//                } else {
//                    studentSign.setDeleted(1);
//                }
//
//                String state = "";
//                String SignState = rs.getString("SignState");
//
//                // state 状态
//                if (!StrUtil.isBlank(SignState)) {
//                    int signStateInt = Integer.parseInt(SignState);
//                    if (signStateInt > 0 && signStateInt < 4 && deleted == 1) {
//                        state = StudentSignConstants.STATE_VALID;
//                        Student updateStudent = new Student();
//                        updateStudent.setId(student.getId());
//                        updateStudent.setSignCategory(StudentSignConstants.SIGN_CATEGORY_XYJY);
//                        String IsLock = rs.getString("IsLock ");
//                        if ("1".equals(IsLock)) {
//                            updateStudent.setDirectionalState(StudentConstants.DIRECTIONAL_STATE_LOCK);
//                        } else {
//                            updateStudent.setDirectionalState(StudentConstants.DIRECTIONAL_STATE);
//                        }
//                        studentList.add(updateStudent);
//                    } else {
//                        state = StudentSignConstants.STATE_INVALID;
//                    }
//                }
//
//                String signState = "";
//                String SurrenderState = rs.getString("SurrenderState");
//                if (!StrUtil.isBlank(SignState) && (StrUtil.isBlank(SurrenderState) || "0".equals(SurrenderState))) {
//                    switch (SignState) {
//                        case "0":
//                            signState = StudentSignConstants.SIGN_STATE_COMPANY_INVITED;
//                            break;
//                        case "1":
//                            signState = StudentSignConstants.SIGN_STATE_STUDENT_AGREED;
//                            break;
//                        case "-1":
//                            signState = StudentSignConstants.SIGN_STATE_STUDENT_REFUSED;
//                            break;
//                        case "2":
//                            signState = StudentSignConstants.SIGN_STATE_SCHOOL_PASS;
//                            break;
//                        case "-2":
//                            signState = StudentSignConstants.SIGN_STATE_COLLEGE_FAIL;
//                            break;
//                        case "3":
//                            signState = StudentSignConstants.SIGN_STATE_SCHOOL_PASS;
//                            break;
//                        case "-3":
//                            signState = StudentSignConstants.SIGN_STATE_COLLEGE_FAIL;
//                            break;
//                        case "-4":
//                            signState = StudentSignConstants.SIGN_STATE_SCHOOL_TERMINATION_PASS;
//                            break;
//                    }
//                } else {
//                    switch (SurrenderState) {
//                        case "1":
//                            signState = StudentSignConstants.SIGN_STATE_STUDENT_TERMINATION;
//                            break;
//                        case "2":
//                            signState = StudentSignConstants.SIGN_STATE_STUDENT_TERMINATION;
//                            break;
//                        case "-2":
//                            signState = StudentSignConstants.SIGN_STATE_COLLEGE_TERMINATION_FAIL;
//                            break;
//                        case "3":
//                            signState = StudentSignConstants.SIGN_STATE_COLLEGE_TERMINATION_PASS;
//                            break;
//                        case "-3":
//                            signState = StudentSignConstants.SIGN_STATE_COLLEGE_TERMINATION_FAIL;
//                            break;
//                        case "4":
//                            signState = StudentSignConstants.SIGN_STATE_SCHOOL_TERMINATION_PASS;
//                            break;
//                        case "-4":
//                            signState = StudentSignConstants.SIGN_STATE_SCHOOL_TERMINATION_FAIL;
//                            break;
//                    }
//                }
//
//                String SignGenerateType = rs.getString("SignGenerateType");
//                String signWay = "2".equals(SignGenerateType) ? StudentSignConstants.SIGN_WAY_STUDENT : StudentSignConstants.SIGN_WAY_COMPANY;
//                String dealCategory = "2".equals(SignGenerateType) ? StudentSignConstants.SIGN_DEAL_CATEGORY_FALSE : StudentSignConstants.SIGN_DEAL_CATEGORY_TRUE;
//                String dealRolePick = rs.getString("IsHiringMode");
//                if (StrUtil.isBlank(dealRolePick) || "0".equals(dealRolePick) && "1".equals(signWay)) {
//                    dealRolePick = StudentSignConstants.SIGN_DEAL_ROLE_PICK_COMPANY;
//                } else {
//                    dealRolePick = StudentSignConstants.SIGN_DEAL_ROLE_PICK_STUDENT;
//                }
//                String dealHbIndustry = rs.getString("KeyIndustry");
//                dealHbIndustry = !StrUtil.isBlank(dealHbIndustry) ? dealHbIndustry : "0";
//
//
//                studentSign.setOldId(rs.getInt("SignID"));
//                studentSign.setOldCategory(1);
//                studentSign.setUserId(student.getUserId());
//                studentSign.setStudentId(student.getId());
//                studentSign.setCompanyId(company.getId());
//                studentSign.setSerialNumber(rs.getString("TableID"));
//                studentSign.setState(state);
//                studentSign.setSignState(signState);
//                studentSign.setDispatchState(StudentSignConstants.DISPATCH_STATE_SCHOOL_PASS);
//                studentSign.setSignCategory(rs.getString("EmploymentWay"));
//                studentSign.setSignWay(signWay);
//                studentSign.setSignTime(DateUtil.parse(rs.getString("CollegeCheckTime")));
//                // 没有
//                studentSign.setSignAgreedTime(null);
//                studentSign.setSignInvitedTime(DateUtil.parse(rs.getString("CreateTime")));
//                studentSign.setSignExpiredTime(DateUtil.offsetDay(studentSign.getSignInvitedTime(), 14));
//
//                studentSign.setDealCategory(dealCategory);
//                studentSign.setDealRolePick(dealRolePick);
//
//                String organizationCode = rs.getString("Organization");
//                if (!StrUtil.isBlank(organizationCode)) {
//                    organizationCode = organizationCode.trim();
//                }
//                studentSign.setDealCompanyOrganizationCode(organizationCode);
//
//                studentSign.setDealSignCompanyName(rs.getString("CompanyName"));
//                studentSign.setDealCompanySuperiorDepartment(rs.getString("SuperiorDepartment"));
//                studentSign.setDealCompanyAddressLevel(rs.getString("LocationLevel"));
//                studentSign.setDealCompanyNature(rs.getString("Nature"));
//                studentSign.setDealCompanyIndustry(rs.getString("Industry"));
//                studentSign.setDealHbIndustry(dealHbIndustry);
//                studentSign.setDealCompanyContactName(rs.getString("Contact"));
//                studentSign.setDealCompanyContactMobile(rs.getString("Tel"));
//
//                String zipCode = rs.getString("ZipCode");
//                if (!StrUtil.isBlank(zipCode)) {
//                    zipCode = zipCode.trim();
//                }
//                studentSign.setDealCompanyContactZip(zipCode);
//
//                studentSign.setDealCompanyContactEmail(rs.getString("Email"));
//                studentSign.setDealCompanyContactAddress(rs.getString("Address"));
//                studentSign.setDealCompanyName(rs.getString("dealCompanyName"));
//                studentSign.setDealCompanyAddress(dictService.cacheValue("syszd", rs.getString("Location")));
//                studentSign.setDealExpireTime(rs.getString("HirePeriod"));
//                studentSign.setDealWorkAddress(rs.getString("WorkingPlace"));
//                studentSign.setDealWorkPosition(rs.getString("JobPosition"));
//                studentSign.setDealWorkJobCategory(rs.getString("JobPositionCategory"));
//                studentSign.setDealReportTime(rs.getString("RegistrationPeriod"));
//                studentSign.setDealReportAddress(rs.getString("RegistrationPlace"));
//                studentSign.setDealTryoutTime(rs.getString("OnTrialTime"));
//                studentSign.setDealTryoutSalary(rs.getString("TheProbationPeriodSalary"));
//                studentSign.setDealFormalSalary(rs.getString("PositiveAfterStartingSalary"));
//                studentSign.setDealPenalty(rs.getString("LiquidatedDamages"));
//                studentSign.setDealRemarks(rs.getString("ProtocolNote"));
//
//                studentSign.setDispatchHiredWay(dictService.cacheValue(DictConstants.TYPE_SIGN_LYFS, rs.getString("HiringMode")));
//                studentSign.setDispatchJobCategory(rs.getString("EmploymentType"));
//                studentSign.setDispatchGradWhere(rs.getString("Graduate"));
//                studentSign.setDispatchReportIssuedCategory(rs.getString("JobCategory"));
//                studentSign.setDispatchReportCompany(rs.getString("ReportCardToUnitName"));
//                studentSign.setDispatchReportCompanyProvince(rs.getString("UnitOfTheProvince"));
//                studentSign.setDispatchReportCompanyAddress(dictService.cacheValue("syszd", rs.getString("UnitLocation")));
//                studentSign.setDispatchArchivesCompany(rs.getString("DaForwardingUnitName"));
//                studentSign.setDispatchArchivesAddress(rs.getString("DaForwardingAddress"));
//
//                String daForwardingCode = rs.getString("DaForwardingCode");
//                if (!StrUtil.isBlank(daForwardingCode)) {
//                    daForwardingCode = daForwardingCode.trim();
//                }
//                studentSign.setDispatchArchivesZip(daForwardingCode);
//
//                studentSign.setDispatchArchivesMobile(rs.getString("DaForwardingTel"));
//                studentSign.setDispatchHkAddressWho(rs.getString("AddressOfAddress"));
//                studentSign.setDispatchHkAddress(rs.getString("AccountMigrationAddress"));
//                studentSign.setDispatchCompanyMembership(dictService.cacheValue(DictConstants.TYPE_SIGN_DWLS, rs.getString("UnitSubjection")));
//                studentSign.setDispatchCompanyName(studentSign.getDispatchArchivesCompany());
//
//
//                String dispatchCompanyCode = "";
//                String dispatchHiredWay = studentSign.getDispatchHiredWay();
//                if (StudentSignConstants.LYFS_01.equals(dispatchHiredWay)) {
//                    StudentSign studentSignDispatchCompanyCode = new StudentSign();
//                    dispatchCompanyService.getDispatchByCode(studentSignDispatchCompanyCode, student.getSyszd());
//                    dispatchCompanyCode = studentSignDispatchCompanyCode.getDispatchCompanyCode();
//                }
//
//                if (StudentSignConstants.LYFS_02.equals(dispatchHiredWay)) {
//                    dispatchCompanyCode = "9150";
//                }
//
//                if (StudentSignConstants.LYFS_03.equals(dispatchHiredWay)) {
//                    dispatchCompanyCode = studentSign.getDispatchReportCompanyProvince();
//                }
//
//                if (StudentSignConstants.LYFS_04.equals(dispatchHiredWay)) {
//                    dispatchCompanyCode = studentSign.getDispatchReportCompanyProvince();
//                }
//
//                if (StudentSignConstants.LYFS_05.equals(dispatchHiredWay)) {
//                    dispatchCompanyCode = "4201";
//                }
//
//                if (StudentSignConstants.LYFS_06.equals(dispatchHiredWay)) {
//                    dispatchCompanyCode = studentSign.getDispatchReportCompanyProvince();
//                }
//                studentSign.setDispatchCompanyCode(dispatchCompanyCode);
//
//                studentSign.setDispatchManagedWhere(studentSign.getDispatchReportCompany());
//                studentSign.setDispatchJobCondition(rs.getString("EmploymentState"));
//
//                studentSignService.setExt(studentSign, student);
//
//                studentSign.setSurveySalary(rs.getString("MonthlySalaryGrade"));
//                studentSign.setSurveyWay(rs.getString("GetUnitInfo"));
//                studentSign.setSurveyCompany(rs.getString("UnitSatisfaction"));
//                studentSign.setSurveyJob(rs.getString("IsCorrelation"));
//                studentSign.setSurveyMatching(rs.getString("IsMatching"));
//                studentSign.setSurveyOffer(rs.getString("OfferNum"));
//                studentSign.setSurveySchool(rs.getString("SchoolWorkSatisfaction"));
//
//                String PicUrl = rs.getString("PicUrl");
//                if (!StrUtil.isBlank(rs.getString("PicUrl"))) {
//                    PicUrl = PATH + PicUrl;
//                }
//                studentSign.setCenterImg(PicUrl);
//
//                studentSign.setSignTerminationTime(DateUtil.parse(rs.getString("SurrenderTime")));
//                studentSign.setTerminationTitle(rs.getString("SurrenderReason"));
//                studentSign.setTerminationContent(rs.getString("SurrenderComment"));
//                String JyUrl = rs.getString("JyUrl");
//                if (!StrUtil.isBlank(JyUrl)) {
//                    JyUrl = PATH + JyUrl;
//                }
//                //studentSign.setTerminationImg(rs.getString("SurrenderFileUrl"));
//                studentSign.setTerminationImg(JyUrl);
//                studentSign.setTerminationTime(null);
//
//
//                String CertifyUrl = rs.getString("CertifyUrl");
//                if (!StrUtil.isBlank(CertifyUrl)) {
//                    CertifyUrl = PATH + CertifyUrl;
//                }
//                studentSign.setRecordImg(CertifyUrl);
//                studentSign.setRecordContent(rs.getString("SurrenderComment"));
//
//                studentSignList.add(studentSign);
//            }
//
//            studentService.updateBatchById(studentList);
//            studentSignService.saveBatch(studentSignList);
//
//            return JsonResult.ok("成功：" + xhErrors + "----" + companyErrors);
//        } catch (ClassNotFoundException | SQLException e) {
//            return JsonResult.error("连接失败：" + e.getMessage());
//        }
//    }
//
//    /**
//     * Nature 在同步之前要求网签数据库格式化成中文
//     * KeyIndustry 在同步之前要求网签数据库格式化成中文
//     * 注意就业状况、单位性质、就业类别
//     *
//     * @return
//     */
//    @ApiOperation("签约非协议就业数据迁移")
//    @GetMapping("/publicly/transfer/student/sign/employment")
//    public JsonResult employment() {
//
//        String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
//        String dbUrl = "jdbc:sqlserver://192.168.1.144:1433;DatabaseName=TestLawOnlineSignDB";
//        String name = "sa";
//        String password = "123456";
//
//        Connection conn = null;
//        String sql = "SELECT\n" +
//                "e.State,\n" +
//                "e.EmploymentID,\n" +
//                "s.GraduationYear,\n" +
//                "s.StudentNo,\n" +
//                "e.EmploymentWay,\n" +
//                "e.EmploymentState,\n" +
//                "e.GraduateCategory,\n" +
//                "b20.KeyValue EmploymentType,\n" +
//                "b1.KeyValue JobCategory,\n" +
//                "e.Graduate,\n" +
//                "e.ReportCardCategory,\n" +
//                "e.CompanyName,\n" +
//                "b2.KeyValue UnitProvince,\n" +
//                "e.LocationArea,\n" +
//                "e.DaForwardingUnitName,\n" +
//                "e.DaForwardingAddress,\n" +
//                "e.DaForwardingCode,\n" +
//                "e.DaForwardingTel,\n" +
//                "e.AccountMigrationAddress,\n" +
//                "e.UnitSubjection,\n" +
//                "e.JobState,\n" +
//                "e.OrganizationCode,\n" +
//                "e.ExtensionFive,\n" +
//                "e.Location,\n" +
//                "b3.KeyValue LocationLevel,\n" +
//                "e.Contact,\n" +
//                "e.Tel,\n" +
//                "e.Address,\n" +
//                "e.ZipCode,\n" +
//                "CASE \n" +
//                "WHEN e.EmploymentWay = '12' THEN (select BasicDataName from BasicData where BasicDataID = e.Nature)\n" +
//                "ELSE e.Nature\n" +
//                "END AS Nature,\n" +
//                "\n" +
//                "CASE \n" +
//                "WHEN e.EmploymentWay = '12' THEN (select BasicDataName from BasicData where BasicDataID = e.JobPositionCategory)\n" +
//                "WHEN e.EmploymentWay = '75' THEN (select BasicDataName from BasicData where BasicDataID = e.JobPositionCategory)\n" +
//                "WHEN e.EmploymentWay = '76' THEN (select BasicDataName from BasicData where BasicDataID = e.JobPositionCategory)\n" +
//                "ELSE e.JobPositionCategory\n" +
//                "END AS JobPositionCategory,\n" +
//                "\n" +
//                "e.KeyIndustry,\n" +
//                "\n" +
//                "CASE\n" +
//                "WHEN e.EmploymentWay != '80' THEN (select BasicDataName from BasicData where BasicDataID = e.Industry)\n" +
//                "ELSE e.Industry\n" +
//                "END AS Industry,\n" +
//                "\n" +
//                "e.ArrivalTime,\n" +
//                "e.ContractPeriod,\n" +
//                "e.BusinessCategory,\n" +
//                "e.BusinessName,\n" +
//                "e.BusinessPlace,\n" +
//                "e.BusinessPlacePic,\n" +
//                "e.NetShopName,\n" +
//                "e.NetPlatform,\n" +
//                "e.Website,\n" +
//                "e.BusinessReg,\n" +
//                "e.BusinessScope,\n" +
//                "e.BusinessRegPic,\n" +
//                "e.BusinessLlicenseReg,\n" +
//                "e.RegTime,\n" +
//                "e.SchoolName,\n" +
//                "e.AdmissionWay,\n" +
//                "e.IsCrossMajor,\n" +
//                "e.UnemployedCategory,\n" +
//                "b13.KeyValue GetUnitInfo,\n" +
//                "b14.KeyValue UnitSatisfaction,\n" +
//                "b15.KeyValue IsCorrelation,\n" +
//                "b16.KeyValue IsMatching,\n" +
//                "b17.KeyValue OfferNum,\n" +
//                "b18.KeyValue SchoolWorkSatisfaction,\n" +
//                "b19.KeyValue UnitSalary,\n" +
//                "e.FileUrl FileUrl,\n" +
//                "f.FileUrl FileFileUrl,\n" +
//                "e.OfferPicUrl OfferPicUrl\n" +
//                "FROM Employment e\n" +
//                "LEFT JOIN Student s ON s.StudentID = e.StudentID\n" +
//                "LEFT JOIN BasicData b1 ON b1.BasicDataName = e.JobCategory\n" +
//                "LEFT JOIN BasicData b2 ON b2.BasicDataID = e.UnitProvince\n" +
//                "LEFT JOIN BasicData b3 ON b3.BasicDataID = e.LocationLevel\n" +
//                "LEFT JOIN BasicData b11 ON b11.BasicDataID = e.JobPositionCategory\n" +
//                "LEFT JOIN BasicData b13 ON b13.BasicDataID = e.GetUnitInfo\n" +
//                "LEFT JOIN BasicData b14 ON b14.BasicDataID = e.UnitSatisfaction\n" +
//                "LEFT JOIN BasicData b15 ON b15.BasicDataID = e.IsCorrelation\n" +
//                "LEFT JOIN BasicData b16 ON b16.BasicDataID = e.IsMatching\n" +
//                "LEFT JOIN BasicData b17 ON b17.BasicDataID = e.OfferNum\n" +
//                "LEFT JOIN BasicData b18 ON b18.BasicDataID = e.SchoolWorkSatisfaction\n" +
//                "LEFT JOIN BasicData b19 ON b19.BasicDataID = e.UnitSalary\n" +
//                "LEFT JOIN BasicData b20 ON b20.BasicDataID = s.EmploymentType\n" +
//                "LEFT JOIN EmploymentFile f ON f.EmploymentID = e.EmploymentID\n" +
//                "WHERE s.StudentID = 20621";
//
//        try {
//            Class.forName(driverName);
//            conn = DriverManager.getConnection(dbUrl, name, password);
//            Statement st = conn.createStatement();
//
//            ResultSet rs = st.executeQuery(sql);
//
//            String xhErrors = "";
//            List<Student> students = studentService.list();
//
//            List<Student> studentList = new ArrayList<>();
//            List<StudentSign> studentSignList = new ArrayList<>();
//
//            while (rs.next()) {
//                StudentSign studentSign = new StudentSign();
//
//                String xh = rs.getString("StudentNo");
//                Student student = null;
//                for (Student s : students) {
//                    if (!StrUtil.isBlank(xh) && xh.equals(s.getXh())) {
//                        student = s;
//                        break;
//                    }
//                }
//                if (student == null) {
//                    xhErrors += "'" + xh + "',";
//                    continue;
//                }
//
//                // 基础信息
//                studentSign.setOldId(rs.getInt("EmploymentID"));
//                studentSign.setOldCategory(2);
//                studentSign.setUserId(student.getUserId());
//                studentSign.setStudentId(student.getId());
//
//                String state = rs.getString("State");
//                if ("0".equals(state)) {
//                    state = StudentSignConstants.STATE_INVALID;
//                } else {
//                    state = StudentSignConstants.STATE_VALID;
//                }
//                studentSign.setState(state);
//
//                int deleted = rs.getInt("State");
//                if (1 == deleted) {
//                    studentSign.setDeleted(0);
//                } else {
//                    studentSign.setDeleted(1);
//                }
//
//                studentSign.setDispatchState(StudentSignConstants.DISPATCH_STATE_SCHOOL_PASS);
//                String signState = rs.getString("EmploymentState");
//                switch (signState) {
//                    case "0":
//                        signState = StudentSignConstants.SIGN_STATE_STUDENT_SUBMIT;
//                        break;
//                    case "1":
//                        signState = StudentSignConstants.SIGN_STATE_SCHOOL_PASS;
//                        break;
//                    case "-1":
//                        signState = StudentSignConstants.SIGN_STATE_COLLEGE_FAIL;
//                        break;
//                    case "2":
//                        signState = StudentSignConstants.SIGN_STATE_SCHOOL_PASS;
//                        break;
//                    case "-2":
//                        signState = StudentSignConstants.SIGN_STATE_COLLEGE_FAIL;
//                        break;
//                    case "20":
//                        signState = StudentSignConstants.SIGN_STATE_SCHOOL_PASS;
//                        studentSign.setDispatchState(StudentSignConstants.DISPATCH_STATE_EDIT_STUDENT_SUBMIT);
//                        break;
//                    case "21":
//                        signState = StudentSignConstants.SIGN_STATE_SCHOOL_PASS;
//                        studentSign.setDispatchState(StudentSignConstants.DISPATCH_STATE_EDIT_SCHOOL_PASS);
//                        break;
//                }
//                studentSign.setSignState(signState);
//
//                studentSign.setSignCategory(rs.getString("EmploymentWay"));
//                studentSign.setSignWay(StudentSignConstants.SIGN_WAY_STUDENT);
//                studentSign.setDealCategory(StudentSignConstants.SIGN_DEAL_CATEGORY_FALSE);
//                studentSign.setDealRolePick(StudentSignConstants.SIGN_DEAL_ROLE_PICK_STUDENT);
//                studentSign.setDispatchHkAddressWho(StudentSignConstants.DISPATCH_HK_ADDRESS_WHO_STUDENT);
//
//                // 信息有效 更改学生就业方式
//                if (StudentSignConstants.STATE_VALID.equals(studentSign.getState())) {
//                    Student updateStudent = new Student();
//                    updateStudent.setId(student.getId());
//                    updateStudent.setSignCategory(studentSign.getSignCategory());
//                    studentList.add(updateStudent);
//                }
//
//                // 派遣信息
//                studentSign.setDispatchHiredWay(dictService.cacheValue(DictConstants.TYPE_SIGN_LYFS, rs.getString("GraduateCategory")));
//                studentSign.setDispatchJobCategory(rs.getString("EmploymentType"));
//                studentSign.setDispatchGradWhere(dictService.cacheValue("sign_byqx", rs.getString("Graduate")));
//                studentSign.setDispatchReportIssuedCategory(dictService.cacheValue("sign_bdzqflb", rs.getString("ReportCardCategory")));
//                studentSign.setDispatchReportCompany(rs.getString("CompanyName"));
//                studentSign.setDispatchReportCompanyProvince(rs.getString("UnitProvince"));
//                studentSign.setDispatchReportCompanyAddress(dictService.cacheValue("syszd", rs.getString("LocationArea")));
//                studentSign.setDispatchArchivesCompany(rs.getString("DaForwardingUnitName"));
//                studentSign.setDispatchArchivesAddress(rs.getString("DaForwardingAddress"));
//
//                String daForwardingCode = rs.getString("DaForwardingCode");
//                if (!StrUtil.isBlank(daForwardingCode)) {
//                    daForwardingCode = daForwardingCode.trim();
//                    if (daForwardingCode.length() > 6) {
//                        daForwardingCode = "000000";
//                    }
//                }
//
//                studentSign.setDispatchArchivesZip(daForwardingCode);
//
//                studentSign.setDispatchArchivesMobile(rs.getString("DaForwardingTel"));
//                studentSign.setDispatchHkAddress(rs.getString("AccountMigrationAddress"));
//                studentSign.setDispatchCompanyMembership(dictService.cacheValue(DictConstants.TYPE_SIGN_DWLS, rs.getString("UnitSubjection")));
//                studentSign.setDispatchCompanyName(studentSign.getDispatchArchivesCompany());
//                studentSign.setDispatchManagedWhere(studentSign.getDispatchReportCompany());
//
//                // 灵活
//                if (StudentSignConstants.SIGN_CATEGORY_LHJY.equals(studentSign.getSignCategory())) {
//                    lhjy(studentSign, rs);
//                }
//
//                // 自主创业
//                if (StudentSignConstants.SIGN_CATEGORY_ZZCY.equals(studentSign.getSignCategory())) {
//                    zzcy(studentSign, rs);
//                }
//
//                // 自由职业
//                if (StudentSignConstants.SIGN_CATEGORY_ZYZY.equals(studentSign.getSignCategory())) {
//                    zyzy(studentSign, rs);
//                }
//
//                // 升学
//                if (StudentSignConstants.SIGN_CATEGORY_SX.equals(studentSign.getSignCategory())) {
//                    sx(studentSign, rs);
//                }
//
//                // 出国出境
//                if (StudentSignConstants.SIGN_CATEGORY_CGCJ.equals(studentSign.getSignCategory())) {
//                    cgcj(studentSign, rs);
//                }
//
//                // 待就业
//                if (StudentSignConstants.SIGN_CATEGORY_DJY.equals(studentSign.getSignCategory())) {
//                    djy(studentSign, rs);
//                }
//
//                // 工作职位类别
//                studentSign.setDealWorkJobCategory(dictService.cacheValue("sign_gzzwlb", rs.getString("JobPositionCategory")));
//
//                // 设置扩展项 单位代码 升学附加
//                studentSignService.setExt(studentSign, student);
//
//                // 备案证明
//                String FileUrl = rs.getString("FileUrl");
//                if (!StrUtil.isBlank(FileUrl)) {
//                    FileUrl = PATH + FileUrl;
//                }
//                studentSign.setRecordImg(FileUrl);
//
//                // 人才机构接收函
//                String FileFileUrl = rs.getString("FileFileUrl");
//                if (!StrUtil.isBlank(FileFileUrl)) {
//                    FileFileUrl = PATH + FileFileUrl;
//                }
//                studentSign.setCenterImg(FileFileUrl);
//
//                // 问卷
//                studentSign.setSurveyStartingSalary(rs.getString("UnitSalary"));
//                studentSign.setSurveyWay(rs.getString("GetUnitInfo"));
//                studentSign.setSurveyCompany(rs.getString("UnitSatisfaction"));
//                studentSign.setSurveyJob(rs.getString("IsCorrelation"));
//                studentSign.setSurveyMatching(rs.getString("IsMatching"));
//                studentSign.setSurveyOffer(rs.getString("OfferNum"));
//                studentSign.setSurveySchool(rs.getString("SchoolWorkSatisfaction"));
//
//                studentSignList.add(studentSign);
//            }
//
//            studentService.updateBatchById(studentList);
//            studentSignService.saveBatch(studentSignList);
//
//            return JsonResult.ok("成功：" + xhErrors);
//        } catch (ClassNotFoundException | SQLException e) {
//            return JsonResult.error("连接失败：" + e.getMessage());
//        }
//    }
//
//    public void lhjy(StudentSign studentSign, ResultSet rs) throws SQLException {
//        studentSign.setDealCompanyName(rs.getString("ExtensionFive"));
//
//        String organizationCode = rs.getString("OrganizationCode");
//        if (!StrUtil.isBlank(organizationCode)) {
//            organizationCode = organizationCode.trim();
//        }
//        studentSign.setDealCompanyOrganizationCode(organizationCode);
//
//        studentSign.setDealCompanyAddress(dictService.cacheValue("syszd", rs.getString("Location")));
//        studentSign.setDealCompanyAddressLevel(rs.getString("LocationLevel"));
//        studentSign.setDealCompanyContactName(rs.getString("Contact"));
//        studentSign.setDealCompanyContactMobile(rs.getString("Tel"));
//        studentSign.setAgileAddress(rs.getString("Address"));
//
//        String zipCode = rs.getString("ZipCode");
//        if (!StrUtil.isBlank(zipCode)) {
//            zipCode = zipCode.trim();
//        }
//        studentSign.setDealCompanyContactZip(zipCode);
//
//        studentSign.setDealCompanyNature(dictService.cacheValue("company_nature", rs.getString("Nature")));
//        studentSign.setDealHbIndustry(dictService.cacheValue("sign_hbzdcy", rs.getString("KeyIndustry")));
//        studentSign.setDealCompanyIndustry(dictService.cacheValue("company_industry", rs.getString("Industry")));
//        studentSign.setAgilePositionTime(rs.getString("ArrivalTime"));
//        studentSign.setAgileTermTime(rs.getString("ContractPeriod"));
//
//        // 灵活就业单位性质自选
//        studentSign.setDispatchJobCondition(StudentSignConstants.SIGN_JYZK_LHJY);
//    }
//
//    public void zzcy(StudentSign studentSign, ResultSet rs) throws SQLException {
//        studentSign.setVentureExplain(rs.getString("BusinessCategory"));
//        // 实体创业
//        if ("1".equals(studentSign.getVentureExplain())) {
//            studentSign.setVentureCompanyName(rs.getString("BusinessName"));
//            studentSign.setVentureComapnyPlace(rs.getString("BusinessPlace"));
//            String BusinessPlacePic = rs.getString("BusinessPlacePic");
//            if (!StrUtil.isBlank(BusinessPlacePic)) {
//                BusinessPlacePic = PATH + BusinessPlacePic;
//            }
//            studentSign.setVenturePlaceImg(BusinessPlacePic);
//        }
//        // 电子商务
//        if ("2".equals(studentSign.getVentureExplain())) {
//            studentSign.setVentureCompanyName(rs.getString("NetShopName"));
//            studentSign.setVentureComapnyPlace(rs.getString("NetPlatform"));
//            studentSign.setVentureWebsite(rs.getString("Website"));
//        }
//
//        String BusinessRegPic = rs.getString("BusinessRegPic");
//        if (!StrUtil.isBlank(BusinessRegPic)) {
//            BusinessRegPic = PATH + BusinessRegPic;
//        }
//        studentSign.setVentureBusinessImg(BusinessRegPic);
//
//        String BusinessReg = rs.getString("BusinessReg");
//        if ("有".equals(BusinessReg)) {
//            BusinessReg = "0";
//        }
//        if ("无".equals(BusinessReg)) {
//            BusinessReg = "1";
//        }
//        studentSign.setVentureBusinessRegistered(BusinessReg);
//        studentSign.setVentureComapnyScope(rs.getString("BusinessScope"));
//        studentSign.setDealCompanyOrganizationCode(rs.getString("BusinessLlicenseReg"));
//        studentSign.setVentureRegisteredTime(rs.getString("RegTime"));
//        studentSign.setDealHbIndustry(dictService.cacheValue("sign_hbzdcy", rs.getString("KeyIndustry")));
//        studentSign.setDealCompanyName(rs.getString("ExtensionFive"));
//        studentSign.setDealCompanyIndustry(dictService.cacheValue("company_industry", rs.getString("Industry")));
//        studentSign.setDealCompanyAddressLevel(rs.getString("LocationLevel"));
//        studentSign.setDealCompanyAddress(dictService.cacheValue("syszd", rs.getString("Location")));
//        studentSign.setDealCompanyNature(StudentSignConstants.SIGN_CATEGORY_ZZCY);
//        studentSign.setDispatchJobCondition(StudentSignConstants.SIGN_JYZK_ZZCY);
//    }
//
//    public void zyzy(StudentSign studentSign, ResultSet rs) throws SQLException {
//        studentSign.setFreeWorkAddress(dictService.cacheValue("syszd", rs.getString("Location")));
//        studentSign.setFreeWorkContent(rs.getString("ExtensionFive"));
//        studentSign.setDealHbIndustry(dictService.cacheValue("sign_hbzdcy", rs.getString("KeyIndustry")));
//
//        studentSign.setDealCompanyNature(StudentSignConstants.SIGN_CATEGORY_ZYZY);
//        studentSign.setDispatchJobCondition(StudentSignConstants.SIGN_JYZK_ZYZY);
//    }
//
//    public void sx(StudentSign studentSign, ResultSet rs) throws SQLException {
//        studentSign.setStudySchoolName(rs.getString("SchoolName"));
//        studentSign.setStudySchoolAddress(dictService.cacheValue("syszd", rs.getString("Location")));
//        studentSign.setStudySchoolProvince(rs.getString("UnitProvince"));
//        studentSign.setStudySchoolAddressLevel(rs.getString("LocationLevel"));
//
//        String GraduateCategory = rs.getString("GraduateCategory");
//        String AdmissionWay = "";
//        if (GraduateCategory.equals("保送")) {
//            AdmissionWay = "1";
//        }
//        if (GraduateCategory.equals("考取")) {
//            AdmissionWay = "2";
//        }
//        if (GraduateCategory.equals("第二学位")) {
//            AdmissionWay = "3";
//        }
//        studentSign.setStudySchoolAdmissionWay(AdmissionWay);
//
//        studentSign.setStudySchoolCrossMajor(dictService.cacheValue("sign_study_school_cross_major", rs.getString("IsCrossMajor")));
//        // setExt 会处理
//        studentSign.setStudyExtraOne(null);
//        studentSign.setStudyExtraTwo(null);
//
//        studentSign.setDealCompanyNature(StudentSignConstants.SIGN_CATEGORY_SX);
//        studentSign.setDispatchJobCondition(StudentSignConstants.SIGN_JYZK_SX);
//
//        String FileUrl = rs.getString("FileUrl");
//        if (!StrUtil.isBlank(FileUrl)) {
//            FileUrl = PATH + FileUrl;
//        }
//        studentSign.setStudyImg(FileUrl);
//        studentSign.setRecordImg("");
//    }
//
//    public void cgcj(StudentSign studentSign, ResultSet rs) throws SQLException {
//        studentSign.setAbroadContinent(7);
//        studentSign.setAbroadCountry(8);
//
//        String address = rs.getString("ExtensionFive");
//        if (!StrUtil.isBlank(address)) {
//            QsSchool qsSchool = qsSchoolService.getOne(new QueryWrapper<QsSchool>()
//                    .eq("parent_id", 8)
//                    .eq("name", address)
//                    .last("limit 1")
//            );
//            if (qsSchool != null) {
//                studentSign.setAbroadSchool(qsSchool.getId());
//            } else {
//                QsSchool newQsSchool = new QsSchool();
//                newQsSchool.setParentId(8);
//                newQsSchool.setName(address);
//                qsSchoolService.save(newQsSchool);
//                studentSign.setAbroadSchool(newQsSchool.getId());
//            }
//        } else {
//            studentSign.setAbroadSchool(9);
//        }
//
//        String OfferPicUrl = rs.getString("OfferPicUrl");
//        if (!StrUtil.isBlank(OfferPicUrl)) {
//            OfferPicUrl = PATH + OfferPicUrl;
//        }
//        studentSign.setAbroadOfferImg(OfferPicUrl);
//
//        studentSign.setDealCompanyNature(StudentSignConstants.SIGN_CATEGORY_CGCJ);
//        studentSign.setDispatchJobCondition(StudentSignConstants.SIGN_JYZK_CGCJ);
//    }
//
//    public void djy(StudentSign studentSign, ResultSet rs) throws SQLException {
//        studentSign.setWaitCategory(dictService.cacheValue("sign_wait_category", rs.getString("UnemployedCategory")));
//
//        studentSign.setDealCompanyNature(StudentSignConstants.SIGN_CATEGORY_DJY);
//        studentSign.setDispatchJobCondition(StudentSignConstants.SIGN_JYZK_DJY);
//    }
//
//}
